<?php

namespace App\Http\Requests\System\SysUserModel;

use Illuminate\Foundation\Http\FormRequest;
use OpenApi\Attributes as OA;

/**
* @create 2023-08-17 23:48:33
*/
#[OA\Schema(title: '用户信息表表单', required: ['user_name','nick_name',],)]
class SysUserRequest extends FormRequest {

    #[OA\Property('user_id', title: '用户ID', type: 'string', example: '', description: '')]
    // #[OA\Property('dept_id', title: '部门ID', type: 'string', example: '', description: '')]
    #[OA\Property('user_name', title: '用户账号', type: 'string', example: '', description: '')]
    #[OA\Property('nick_name', title: '用户昵称', type: 'string', example: '', description: '')]
    // #[OA\Property('user_type', title: '用户类型（00系统用户）', type: 'string', example: '', description: '')]
    // #[OA\Property('email', title: '用户邮箱', type: 'string', example: '', description: '')]
    // #[OA\Property('phonenumber', title: '手机号码', type: 'string', example: '', description: '')]
    // #[OA\Property('sex', title: '用户性别（0男 1女 2未知）', type: 'string', example: '', description: '')]
    // #[OA\Property('avatar', title: '头像地址', type: 'string', example: '', description: '')]
    // #[OA\Property('password', title: '密码', type: 'string', example: '', description: '')]
    // #[OA\Property('status', title: '帐号状态（0正常 1停用）', type: 'string', example: '', description: '')]
    // #[OA\Property('del_flag', title: '删除标志（0代表存在 2代表删除）', type: 'string', example: '', description: '')]
    // #[OA\Property('login_ip', title: '最后登录IP', type: 'string', example: '', description: '')]
    // #[OA\Property('login_date', title: '最后登录时间', type: 'string', example: '', description: '')]
    // #[OA\Property('create_by', title: '创建者', type: 'string', example: '', description: '')]
    // #[OA\Property('create_time', title: '创建时间', type: 'string', example: '', description: '')]
    // #[OA\Property('update_by', title: '更新者', type: 'string', example: '', description: '')]
    // #[OA\Property('update_time', title: '更新时间', type: 'string', example: '', description: '')]
    // #[OA\Property('remark', title: '备注', type: 'string', example: '', description: '')]
    public function rules() {       /* 'mobile' => 'required|regex:/^1\d{10}$/' */ 
        // ignore   : 'user_id',
        // nullable : 'dept_id','user_type','email','phonenumber','sex','avatar','password','status','del_flag','login_ip','login_date','create_by','create_time','update_by','update_time','remark',
        return [
            ...(request()->isMethod('put') ? ['user_id' => 'required'] : []),
            // 'dept_id' => 'required',
            'user_name' => 'required',
            'nick_name' => 'required',
            // 'user_type' => 'required|in:00',
            // 'email' => 'required',
            // 'phonenumber' => 'required',
            // 'sex' => 'required|in:0,1,2',
            // 'avatar' => 'required',
            // 'password' => 'required',
            // 'status' => 'required|in:0,1',
            // 'del_flag' => 'required|in:0,2',
            // 'login_ip' => 'required',
            // 'login_date' => 'required',
            // 'create_by' => 'required',
            // 'create_time' => 'required',
            // 'update_by' => 'required',
            // 'update_time' => 'required',
            // 'remark' => 'required',
            // ...(config('admin.admin_catpcha') ? ['code' => 'required',] : []),
        ];
    }

    public function attributes() {  /* 'mobile' => '手机号' */ 
        return [
            'user_id' => '用户ID',
            'dept_id' => '部门ID',
            'user_name' => '用户账号',
            'nick_name' => '用户昵称',
            'user_type' => '用户类型（00系统用户）',
            'email' => '用户邮箱',
            'phonenumber' => '手机号码',
            'sex' => '用户性别（0男 1女 2未知）',
            'avatar' => '头像地址',
            'password' => '密码',
            'status' => '帐号状态（0正常 1停用）',
            'del_flag' => '删除标志（0代表存在 2代表删除）',
            'login_ip' => '最后登录IP',
            'login_date' => '最后登录时间',
            'create_by' => '创建者',
            'create_time' => '创建时间',
            'update_by' => '更新者',
            'update_time' => '更新时间',
            'remark' => '备注',
        ];
    }

    public function messages() {    /* 'mobile.regex' => '手机号格式不对' */ 
        return [
        ];
    }

}